/*
 * @Author: biankai
 * @Date: 2021-04-19 18:47:04
 * @LastEditTime: 2021-11-10 14:27:58
 * @LastEditors: biankai
 * @FilePath: /gitee/devops_service/src/controllers/jenkins/build.controller.ts
 */
import { Controller, Inject, Get, Query, Param, Post, Put, Delete, Body } from '@nestjs/common';
import { ApiCreatedResponse, ApiOperation, ApiTags } from '@nestjs/swagger';
import { BuildService } from '../../services/jenkins/build.service';

@ApiTags('Jenkins-Build')
@Controller('jenkins/build')
export class BuildController {
    constructor(@Inject(BuildService) private readonly buildService: BuildService) {
    }

    @ApiOperation({ summary: '获取', description: '说明 : 调用此接口,可获取' })
    @ApiCreatedResponse({
        description: 'The record has been successfully created.',
    })
    @Get('/buildGet')
    async buildGet(@Query('buildName') buildName, @Query('buildNum') buildNum) {
        return await this.buildService.buildGet(buildName, buildNum)
    }

    @ApiOperation({ summary: '获取', description: '说明 : 调用此接口,可获取' })
    @Get('/buildLog')
    async buildLog(@Query('buildName') buildName, @Query('buildNum') buildNum) {
        return await this.buildService.buildLog(buildName, buildNum)
    }

    @ApiOperation({ summary: '获取', description: '说明 : 调用此接口,可新增' })
    @Get('/buildLogStream')
    async buildLogStream(@Query('buildName') buildName, @Query('buildNum') buildNum) {
        return await this.buildService.buildLogStream(buildName, buildNum)
    }

    @ApiOperation({ summary: '修改', description: '说明 : 调用此接口,可修改' })
    @Post('/buildStop')
    async buildStop(@Query('buildName') buildName, @Query('buildNum') buildNum) {
        return await this.buildService.buildStop(buildName, buildNum)
    }

    @ApiOperation({ summary: '删除', description: '说明 : 调用此接口,可删除' })
    @Get('/buildTerm')
    async buildTerm(@Param('buildName') buildName, @Param('buildNum') buildNum) {
        return await this.buildService.buildTerm(buildName, buildNum)
    }

    // @ApiOperation({ summary: '删除', description: '说明 : 调用此接口,可删除' })
    // @Get('/queueList')
    // async queueList() {
    //     return await this.buildService.queueList()
    // }

    // @ApiOperation({ summary: '删除', description: '说明 : 调用此接口,可删除' })
    // @Get('/queueItem')
    // async queueItem(@Query('buildNum') buildNum) {
    //     return await this.buildService.queueItem(buildNum)
    // }

    // @ApiOperation({ summary: '删除', description: '说明 : 调用此接口,可删除' })
    // @Get('/queueCancel')
    // async queueCancel(@Query('buildNum') buildNum) {
    //     return await this.buildService.queueCancel(buildNum)
    // }


}